package roborally.model;

public class Position {
	/** 
	 * a long variable that contains the x-coordinate
	 */
	private long x;
	/** 
	 * a long variable that contains the y-coordinate
	*/
	private long y;
	
	/**
	 * default constructor initializes the position on (0,0)
	 * @effect	a new position initialized on (0,0)
	 * 			|this(0,0)
	 */
	public Position()
	{
		this(0,0);
	}
	/**
	 * 
	 * @param 	xCo
	 * 			The x-coordinate to initialize the position on.
	 * @param 	yCo
	 * 			The y-coordinate to initialize the position on.
	 * @effect 	a new position initialized on (xCo,yCo)
	 * 			|setPosition(xCo,yCo)
	 */
	public Position(long xCo, long yCo)
	{
		setPosition(xCo,yCo);
	}
	
	/**
	 * @param 	xCo
	 * 			The x-coordinate to initialize the position on.
	 * @param 	yCo
	 * 			The y-coordinate to initialize the position on.
	 * @post 	Both position coordinates are set to the ones given as parameters.
	 * 			new.this.getX() == xCo
	 * 			new.this.getY() == yCo
	 */
	public void setPosition(long xCo, long yCo)
	{
		x = xCo;
		y = yCo;
	}
	
	public long getX(){return x;}
	public long getY(){return y;}
	
	/**
	 * returns the Position's coordinates as a String
	 */
	public String toString()
	{
		return "co(" + x + ", " + y + ")";
	}
	/**
	 * 
	 * @param 	position
	 * 			A position.
	 * @return	Returns true if both x and y coordinates are respectively equal. If not, return false
	 * 			result == this.getX() == position.getX()) && (this.getY() == position.getY()
	 */
	public boolean isEqualTo(Position position)
	{
		return (this.getX() == position.getX()) && (this.getY() == position.getY());
	}
}
